package com.wanxi.array;

/**
 * 通过三元运算符比较大小
 */
public class MaxThreeYuanArray {
    public static void main(String[] args) {
        int[] arr = {5, 44, 33, 55, 22};
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
//            max = max > arr[i] ? max : arr[i];
//            max = Math.max(max, arr[i]);
            if (max < arr[i]) {
//                max = max;
//            } else {
                max = arr[i];
            }
        }
        System.out.println(max);
    }
}
